Skip to content

Conversation

@ivancea
Copy link
Contributor

@ivancea ivancea commented May 8, 2025

Fixes #127833

A Block type randomization was added here (32588b5) to test different code paths based on the specific agg groupIds block type.

Now, a circuit breaking test fails sometimes, as it expects memory usage to be exact and deterministic, and the randomization may choose a more or less optimum path, changing the memory usage.

@ivancea ivancea requested a review from nik9000 May 8, 2025 10:16
@ivancea ivancea added >test Issues or PRs that are addressing/adding tests Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) :Analytics/ES|QL AKA ESQL v9.1.0 labels May 8, 2025
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-analytical-engine (Team:Analytics)

private boolean shouldRandomizeBlocks() {
return Arrays.stream(Thread.currentThread().getStackTrace())
.noneMatch(
e -> e.getClassName().equals(OperatorTestCase.class.getName()) && e.getMethodName().equals("testSimpleCircuitBreaking")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wish we had C#'s nameof() to make this more robust. But I think adding that link in the javadoc is the only simple option we have (?)

Copy link
Member

@nik9000 nik9000 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd really prefer to do this with a function parameter. It's an extra parameter in a zillion places, but it feels more honest.

Comment on lines +40 to +42
protected record SimpleOptions(boolean requiresDeterministicFactory) {
public static final SimpleOptions DEFAULT = new SimpleOptions(false);
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Created this structure instead of just a boolean as it's:

  • Easier to understand from callers
  • Extendable (Not a big concern now, but the first point makes more sense to me)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

/**
* Calls {@link #simple(SimpleOptions)} with the default options.
*/
protected final Operator.OperatorFactory simple() {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added those methods to keep changes at a minimum

public final void testSimpleCircuitBreaking() {
ByteSizeValue memoryLimitForSimple = enoughMemoryForSimple();
Operator.OperatorFactory simple = simple();
Operator.OperatorFactory simple = simple(new SimpleOptions(true));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And this is the method actually using the new param

@ivancea ivancea requested a review from nik9000 May 9, 2025 10:12
Comment on lines +40 to +42
protected record SimpleOptions(boolean requiresDeterministicFactory) {
public static final SimpleOptions DEFAULT = new SimpleOptions(false);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@ivancea ivancea merged commit bccd6f2 into elastic:main May 9, 2025
17 checks passed
@ivancea ivancea deleted the esql-fix-block-randomization-tests branch May 9, 2025 15:13
jfreden pushed a commit to jfreden/elasticsearch that referenced this pull request May 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Analytics/ES|QL AKA ESQL Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) >test Issues or PRs that are addressing/adding tests v9.1.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[CI] FilteredGroupingAggregatorFunctionTests testSimpleCircuitBreaking failing

3 participants